/**
 * Created by yubaolin on 2017/9/23.
 */
import ajax from '../ajax'

export default {
  getManufacturerList (success, fail = null) {
    ajax.get({url: '/api/manufacturer', success, fail})
  },
  saveManufacturer (manufacturer, success, fail = null) {
    const method = manufacturer.id === 0 ? 'post' : 'put'
    ajax[method]({url: `/api/manufacturer/${manufacturer.id}`, data: manufacturer, success, fail})
  },
  deleteManufacturer (id, success, fail = null) {
    ajax.del({url: `/api/manufacturer/${id}`, success, fail})
  },
  deleteManufacturerList (ids, success, fail = null) {
    ajax.del({url: `/api/manufacturer/deleteList`, data: {ids}, success, fail})
  }
}
